<?php
	$css_list[0]['url'][] = './tpl/css/zone.css';
	$js_list[0] = './tpl/js/zone.js';
?>
<!--{template inc/header_n}-->
<!--{template inc/u/u_menu}-->
<div class="wrapper">
	<div class="zone_left">
		<ul class="zone_tab clearfix">
			<li class="c"><a href="{u u/follow uid=$home_uid}">{$_FANWE['home_user_names']['short']}的关注</a></li>
			<li><a href="{u u/fans uid=$home_uid}">{$_FANWE['home_user_names']['short']}的粉丝</a></li>
			<li><a href="{u u/coupon uid=$home_uid}">{$_FANWE['home_user_names']['short']}的优惠券</a></li>
			<li style="float:right;border:none;background:none;">{$_FANWE['user']['coupon_num']}/{$_FANWE['user']['hzl_num']}张优惠券</li>
		</ul>
		<ul class="people_list clearfix" ptype="follow">
            <!--{loop $user_list $follow_user}-->
            <li class="clearfix PEOPLE_ID_BOX" id="people_id_{$follow_user['uid']}">
                <a href="{u u/index uid=$follow_user['uid']}"><img class="avt icard GUID" uid="{$follow_user['uid']}" src="{avatar $follow_user['avatar'] m}" alt="{$follow_user['user_name']}" width="48"></a>
                <div class="people_info">
                    <a class="n icard bc GUID" uid="{$follow_user['uid']}" href="{u u/index uid=$follow_user['uid']}">{$follow_user['user_name']}</a><br>
                    <!--{if !empty($follow_user['reside_province'])}-->
                    <span>{$follow_user['reside_province']} {$follow_user['reside_city']}</span>
                    <!--{/if}-->
                    <span>粉丝{$follow_user['fans']}人</span>
                    <span style="{if isset($coupons[$follow_user['uid']])}font-weight:bold;{/if}">
                        {if isset($coupons[$follow_user['uid']])}
                        已有优惠券
                        {else}
                        未获得优惠券
                        {/if}</span>
                    <!--{if !empty($follow_user['share'])}-->
                    <p>{cutstr $follow_user['share']['content'] 100}({$follow_user['share']['time']})</p>
                    <!--{/if}-->
                </div>
                <div class="people_toolbar">
                    <!--{if $home_uid == $_FANWE['uid']}-->
                    <div class="follow1"{if !$follow_user['is_follow']} style="display:none;"{/if}>
                    <span>已互相关注</span>
                    <br>
                    </div>
                    <div class="follow0"{if $follow_user['is_follow']} style="display:none;"{/if}>
                    <span>已关注</span>
                    <br>
                    </div>
                    <a class="unFollow" href="javascript:void(0);" onclick="$.User_Follow($follow_user['uid'],this,MeUpdateUserFollow);">取消关注</a>
                    <br>
                    <div class="follow1"{if !$follow_user['is_follow']} style="display:none;"{/if}>
                    <a class="delFans" href="javascript:void(0);" onclick="$.Remove_Fans($follow_user['uid'],this,DeleteUserFans);">移除粉丝</a>
                    </div>
                    <div class="follow1">
                    {if !isset($coupons[$follow_user['uid']])}<a class="delFans" href="javascript:void(0);" onclick="coupon_give($follow_user['uid']);" style="color:red;">赠送优惠券</a>{/if}
                    </div>
                    <!--{else}-->
                    <div class="follow1"{if !$follow_user['is_follow']} style="display:none;"{/if}>
                    <span>已关注</span>
                    <br>
                    <a class="unFollow" href="javascript:void(0);" onclick="$.User_Follow($follow_user['uid'],this,MeUpdateUserFollow);">取消关注</a>
                    </div>
                    <a class="addfo follow0" href="javascript:;" onclick="$.User_Follow($follow_user['uid'],this,UpdateUserFollow);"{if $follow_user['is_follow']} style="display:none;"{/if}>+加关注</a>
                    <!--{/if}-->
                </div>
            </li>
            <!--{/loop}-->
        </ul>
        <div class="pagination">
            <!--{subtemplate inc/pages}-->
        </div>
    </div>
    <!--{template inc/u/u_me_right}-->
</div>
<script type="text/javascript">
function MeUpdateUserFollow(obj,result)
{
	$(obj).parents('.PEOPLE_ID_BOX').slideUp("slow");
}

function UpdateUserFollow(obj,result)
{
	var parent = $(obj).parent();
	if(result.status == 1)
	{
		$('.follow0',parent).hide();
		$('.follow1',parent).show();
	}
	else
	{
		$('.follow0',parent.parent()).show();
		$(obj).parent().hide();
	}
	
}

function DeleteUserFans(obj,result)
{
	var parent = $(obj).parent().parent();
	if(result.status == 1)
	{
		$('.follow1',parent).hide();
		$('.follow0',parent).show();
	}
}

function coupon_give(uid) {
    $.get('/u.php?action=coupon_give&uid='+uid, function(s) {
        if(s == '1') alert('该好友已经有优惠券啦！');
        else if(s == '2') {
            alert('优惠券赠送成功！');
            location.reload();
        }
        else if(s == '3') alert('您的优惠券不足！');
    });
}
</script>
<!--{template inc/footer}-->
